package com.scedu.controller;

import com.scedu.service.SignInService;
import com.scedu.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class SignController {
    @Autowired
    SignInService signInService;
    /*
    签到
     */
    @GetMapping("/sign")
    public String sign(){
        Date today = DateUtils.getNowDate();
        Integer cid=12;
        boolean signed  = signInService.doSign(cid, DateUtils.date2LocalDate(today));
        if (signed) {
            System.out.println("您已签到：" + DateUtils.dateTime(today));
            return("您已签到：" + DateUtils.dateTime(today));
        } else {
            System.out.println("签到完成：" + DateUtils.dateTime(today));
            return ("签到完成：" + DateUtils.dateTime(today));
        }
    }
}
